program main

  use namelist_mod
  use variables_mod
  use IO_mod
  use calculation_mod
  
  implicit none

  character(256) namelist_path

  call get_command_argument(1, namelist_path)
  if (namelist_path == '') then
    print*, "You should give a namelist file path!"
    stop
  end if
  call parse_namelist(namelist_path)

  call read_nc_file()
  
  call calc_DCT(u, v, dct_u, dct_v)
  call calc_power_spectral(dct_u, dct_v, power_u, power_v, wavelength, wavenumber)

  call output(power_u, power_v, wavelength, wavenumber)

end program main